<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{% block title %}Flask Todo{% endblock %}</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container">
        <a class="navbar-brand" href="{{ url_for('todo.index') }}">Todo App</a>
        <div class="navbar-nav">
            {% if current_user.is_authenticated %}
            <a class="nav-link" href="{{ url_for('auth.logout') }}">退出</a>
            {% else %}
            <a class="nav-link" href="{{ url_for('auth.login') }}">登录</a>
            <a class="nav-link" href="{{ url_for('auth.register') }}">注册</a>
            {% endif %}
        </div>
    </div>
</nav>

<div class="container mt-4">
    {% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
    {% for category, message in messages %}
    <div class="alert alert-{{ category }} alert-dismissible fade show">
        {{ message }}
        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
    </div>
    {% endfor %}
    {% endif %}
    {% endwith %}

    {% block content %}{% endblock %}
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>